FROM php:8.2-fpm

ENV DEBIAN_FRONTEND=noninteractive

# 安装系统依赖
RUN apt-get update && apt-get install -y \
    librabbitmq-dev \
    build-essential \
    autoconf \
    re2c \
    libpng-dev \
    libonig-dev \
    libzip-dev \
    libxml2-dev \
    libssl-dev \
    zip \
    unzip \
    curl

RUN pecl install amqp && \
    echo "extension=amqp.so" > /usr/local/etc/php/conf.d/docker-php-ext-amqp.ini

# 安装其他 PHP 扩展
# 使用 docker-php-ext-install 安装内置扩展
RUN docker-php-ext-install \
    bcmath \
    pdo_mysql \
    mbstring \
    exif \
    pcntl \
    sockets \
    zip \
    opcache \
    intl \
    gd

COPY . /var/www/html
WORKDIR /var/www/html

EXPOSE 8787

CMD ["php","/var/www/html/start.php","start"]
